//
//  HJUpDownBtn.m
//  MenuView
//
//  Created by uniqhj on 2018/8/31.
//

#import "HJUpDownBtn.h"

@implementation HJUpDownBtn

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:12];
        [self setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    }
    return self;
}

- (CGFloat)radio {
    return 0.7;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect {
    return CGRectMake(0, contentRect.size.height * _radio, contentRect.size.width, contentRect.size.height * (1-_radio));
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect {
    return CGRectMake(0, 0, contentRect.size.width, contentRect.size.height * _radio);
}

@end
